home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
TDE10SRC.ARJ
/
TDESTR.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-05
|
10KB
|
266 lines
/******************* start of original comments ********************/
/*
* Written by Douglas Thomson (1989/1990)
*
* This source code is released into the public domain.
*/
/*
* This file contains all the includes, defines, types and function
* prototypes that are common to all the editor modules.
*/
/********************* end of original comments ********************/
/*
* New editor name: tde, the Thomson-Davis Editor.
* Author: Frank Davis
* Date: June 5, 1991
*
* This modification of Douglas Thomson's code is released into the
* public domain, Frank Davis. You may distribute it freely.
*
* This file contains all the structure declarations and defines common
* to all the editor modules.
*/
#define MAX_KEYS 400
#define MAX_COLS 80 /* widest screen ever used */
#define MAX_LINES 24 /* highest screen ever used */
#define BUFF_SIZE 256 /* buffer size for lines */
#define MAX_LINE_LENGTH 255 /* longest line allowed in file */
#define ERROR (-1) /* abnormal termination */
#define OK 0 /* normal termination */
#define TRUE 1 /* logical true */
#define FALSE 0 /* logical false */
#define RTURN 13 /* Return key = 13 */
#define CONTROL_Z 26 /* Control z = 26 or DOS eof character */
#define ESC 27 /* Escape key = 27 */
/*
* The following defines are used by the "error" function, to indicate
* how serious the error is.
*/
#define WARNING 1 /* user must acknowledge, editor continues */
#define FATAL 2 /* editor aborts - very rare! */
/*
* define the type of block marked by user
*/
#define NOTMARKED 0 /* block type undefined */
#define BLOCK 1 /* block marked by row and column */
#define LINE 2 /* block marked by begin and end lines */
#define MOVE 1
#define DELETE 2
#define COPY 3
#define KOPY 4
#define FILL 5
#define OVERLAY 6
#define LOCAL 1
#define NOT_LOCAL 2
#define GLOBAL 3
#define IGNORE 1
#define MATCH 2
#define PROMPT 1
#define NOPROMPT 2
#define FORWARD 1
#define BACKWARD 2
#define BEGIN 1
#define END 2
#define EXIST 0
#define WRITE 2
#define READ 4
#define READ_WRITE 6
/*
* possible answers to various questions - see get_yn, get_ynaq and get_oa
*/
#define A_YES 1
#define A_NO 2
#define A_ALWAYS 3
#define A_QUIT 4
#define A_ABORT 5
#define A_OVERWRITE 6
#define A_APPEND 7
/*
* The following defines specify which video attributes give desired
* effects on different display devices.
* REVERSE is supposed to be reverse video - a different background color,
* so that even a blank space can be identified.
* HIGH is supposed to quickly draw the user's eye to the relevant part of
* the screen, either for a message or for matched text in find/replace.
* NORMAL is supposed to be something pleasant to look at for the main
* body of the text.
* These defines may not be optimal for all types of display. Eventually
* the user should be allowed to select which attribute is used where.
*/
#define VIDEO_INT 0x10
#define LCD_REVERSE 0x70
#define LCD_NORMAL 0x07
#define LCD_HIGH 0x17
#define HERC_REVERSE 0x70
#define HERC_UNDER 0x01
#define HERC_NORMAL 0x07
#define HERC_HIGH 0x0F
#define COLOR_HEAD 0x4b
#define COLOR_TEXT 0x07
#define COLOR_MODE 0x17
#define COLOR_BLOCK 0x7f
#define COLOR_MESSAGE 0x0f
#define COLOR_HELP 0x1A
#define COLOR_80 3
#define MONO_80 7
/*
* Some systems (like the PC) require a special kind of pointer for
* arrays or structures larger than 64K.
* (Note: only Turbo C's large data memory models
* will compile correctly with this code.)
*/
#ifdef __TURBOC__
typedef char huge *text_ptr;
#elif __MSC__
/* typedef char huge *text_ptr; */
typedef char far *text_ptr;
#else
typedef char *text_ptr;
#endif
struct vcfg {
int color;
int rescan;
int mode;
int far *videomem;
};
typedef struct {
int pattern_length;
int search_case;
int search_defined;
char pattern[MAX_COLS];
char skip_forward[256];
char skip_backward[256];
} boyer_moore_type;
/*
* "displays" contain all the status information about what attributes are
* used for what purposes, which attribute is currently set, and so on.
* The editor only knows about one physical screen.
*/
typedef struct {
int line; /* actual line cursor currently on */
int col; /* actual column cursor currently in */
int nlines; /* lines on display device */
int ncols; /* columns on display device */
int line_length; /* length of longest line */
int mode_line; /* line to display editor modes - fmd */
int head_color; /* file header color */
int text_color; /* text area color */
int mode_color; /* mode line color - footer */
int block_color; /* hilited area of blocked region */
int message_color; /* color of editor messages */
int help_color; /* color of help screen */
char far *display_address; /* address of display memory */
} displays;
/*
* "status_infos" contain all the editor status information that is
* global to the entire editor (i.e. not dependent on the file or
* window)
*/
typedef struct {
struct s_windows *current_window; /* current active window */
struct s_file_infos *current_file; /* current active file */
struct s_file_infos *file_list; /* all active files */
struct s_windows *window_list; /* all active windows */
int file_count; /* number of files currently open */
text_ptr start_mem; /* first char in main text buffer */
text_ptr end_mem; /* last char in main text buffer used+1 */
text_ptr temp_end; /* temporary end_mem marker */
text_ptr max_mem; /* last char available for storage (+1) */
int prompt_col; /* column for putting answer to prompt */
int prompt_line; /* line for putting answer to prompt */
int insert; /* in insert mode? */
int indent; /* in auto-indent mode? */
int tab_size; /* characters between tab stops */
int marked; /* has block been marked? */
struct s_windows *marked_window; /* pointer to window with marked block */
struct s_file_infos *marked_file; /* pointer to file w/ marked block */
char rw_name[MAX_COLS]; /* name of last file read or written */
char pattern[MAX_COLS]; /* last search pattern */
char subst[MAX_COLS]; /* last substitute text */
int replace_flag; /* prompt or noprompt b4 replacing */
int overlap; /* overlap between pages for page up etc */
char line_buff[BUFF_SIZE+2]; /* for currently edited line */
} status_infos;
/*
* "file_infos" contain all the information unique to a given file
*/
typedef struct s_file_infos {
text_ptr start_text; /* first char in file */
text_ptr end_text; /* last char in file (+1) */
long length; /* number of lines in file */
int modified; /* file has been modified since save? */
int new_file; /* is current file new? */
char file_name[MAX_COLS]; /* name of current file being edited */
int block_type; /* block type - line or block */
text_ptr block_start; /* begining block position */
text_ptr block_end; /* ending block position */
int block_bc; /* begining column */
long block_br; /* begining row */
int block_ec; /* ending column */
long block_er; /* ending row */
int ref_count; /* no. of windows referring to file */
int file_attrib; /* file attributes (rwx etc) */
struct s_file_infos *next; /* next file in doubly linked list */
struct s_file_infos *prev; /* previous file in doubly linked list */
} file_infos;
/*
* "windows" contain all the information that is unique to a given
* window.
*/
typedef struct s_windows {
file_infos *file_info; /* file in window */
text_ptr cursor; /* start of line containing cursor */
int ccol; /* column cursor logically in */
int rcol; /* column cursor actually in */
int bcol; /* base column to start display */
int cline; /* line cursor logically in */
long rline; /* real line cursor in */
int top_line; /* top line in window */
int bottom_line; /* bottom line in window */
int page; /* no. of lines to scroll for one page */
int visible; /* window hidden or visible */
int dirty; /* file in window modified? */
struct s_windows *next; /* next window in doubly linked list */
struct s_windows *prev; /* previous window in doubly linked list */
} windows;
/*
* Use a dispatch array-structure to determine function of key pressed
* by user. Initialize it in "default.h". Read in a configuration
* file to change the key functions as desired by user coming soon.
*/
typedef struct {
int func;
} DISPATCH_TABLE;